package com.hwd.gmall.common.constant;

/**
 * Redis常量配置类
 *
 * @author Victor
 */
public class RedisConst {

    /**
     * 缓存空数据key的过期时间，单位：秒
     */
    public static final long KEY_TIMEOUT_FOR_NULL_DATA = 5 * 60;

    /**
     * 热度值更新到es中的频率
     */
    public static final long HOT_SCORE_UPDATE_RATE = 10;

    /**
     * 缓存数据key的过期时间，单位：秒
     */
    public static final long KEY_TIMEOUT_FOR_DATA = 24 * 60 * 60;


    public static final String SKUKEY_PREFIX = "sku:";
    public static final String SKUKEY_SUFFIX = ":info";

    /**
     * 单位：秒
     */
    public static final long SKUKEY_TIMEOUT = 24 * 60 * 60;

    /**
     * 单位：秒 尝试获取锁的最大等待时间
     */
    public static final long SKULOCK_EXPIRE_PX1 = 1;

    /**
     * 单位：秒 锁的持有时间
     */
    public static final long SKULOCK_EXPIRE_PX2 = 1;
    public static final String SKULOCK_SUFFIX = ":lock";

    public static final String USER_KEY_PREFIX = "user:";
    public static final String USER_CART_KEY_SUFFIX = ":cart";
    public static final long USER_CART_EXPIRE = 60 * 60 * 24 * 7;

    /**
     * 用户登录
     */
    public static final String USER_LOGIN_KEY_PREFIX = "user:login:";

    /**
     * public static final String userInfoKey_suffix = ":info";
     */
    public static final int USERKEY_TIMEOUT = 60 * 60 * 24 * 7;

    /**
     * 秒杀商品前缀
     */
    public static final String SECKILL_GOODS = "seckill:goods";
    public static final String SECKILL_ORDERS = "seckill:orders";
    public static final String SECKILL_ORDERS_USERS = "seckill:orders:users";
    public static final String SECKILL_STOCK_PREFIX = "seckill:stock:";
    public static final String SECKILL_USER = "seckill:user:";

    /**
     * 用户锁定时间 单位：秒
     */
    public static final int SECKILL__TIMEOUT = 3600;


}
